from PyQt5.QtWidgets import QWidget
from view.UnpackView import Ui_UnpackView
# from manager.TaskManager import TaskManager
from PyQt5.QtCore import QThread
from PyQt5.Qt import QMutex


class TaskManager(QThread):
    def __init__(self):
        super(TaskManager, self).__init__()

    def run(self):
        print('fsdfdsfsd')


class DEXDump(QWidget, Ui_UnpackView):
    def __init__(self, frida_manager=None, log_out=None):
        super(DEXDump, self).__init__()
        self.setupUi(self)
        self.setLayout(self.verticalLayout)
        self.frida_manager = frida_manager
        self.log_out = log_out
        self.pb_unpack.setText('脱壳')
        self.pb_unpack.clicked.connect(self.unpack_click)

    def unpack_click(self):
        exports = self.frida_manager.get_exports()
        if exports:
            exports.dex_dump()

    def update_text_edit(self):
        pass

    def on_message(self, message, data):
        if message['type'] == 'send':
            text = message['payload']
            self.text_edit.append(text)
        else:
            print(message)